

import axios from "axios"

import type { InternalAxiosRequestConfig, AxiosResponse } from "axios"



const service = axios.create({
    baseURL: "http://118.178.238.19:3001/admin"
})

//请求拦截器

// axios.interceptors.request.use()
service.interceptors.request.use((config: InternalAxiosRequestConfig) => {

    if (sessionStorage.getItem("token")) {
        config.headers.token = sessionStorage.getItem("token")
    }
   
    return config;
})

//响应拦截器
service.interceptors.response.use((res: AxiosResponse) => {
   
    return res
})

export default service